package com.boco.ibssystem.business.controller.common;

import com.boco.biinjectionserviceapi.dto.SummaryDto;
import com.boco.biinjectionserviceapi.dto.WssjzyDto;
import com.boco.biinjectionserviceapi.model.config.ModelConfigEntity;
import com.boco.ibssystem.business.service.WssjzyService;
import com.boco.biinjectionserviceapi.service.config.ICommonModelConfigService;
import com.boco.biinjectionserviceapi.vo.Params;
import com.boco.ibssystem.common.base.AbstractController;
import com.boco.ibssystem.common.result.support.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 获取公用图块配置
 * @Author: 徐建平
 * @CreateDate: 2019/5/15$ 16:08$
 * @UpdateUser: yc
 * @UpdateDate: 2019/5/15$ 16:08$
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */


@RestController
@ResponseResult
@RequestMapping(value = "/common-model")
@Api(tags = "获取公用图块配置")
public class CommonModelController extends AbstractController {

    @Autowired
    private ICommonModelConfigService commonModelConfigService;

    @Autowired
    private WssjzyService wssjzyService;

    @GetMapping("/getModelById")
    @ApiOperation(value = "根据id获取公用图块配置数据")
    public SummaryDto getModelById(int modelId) throws Exception {
        return commonModelConfigService.getSummaryModelById(modelId);
    }

    @GetMapping("/getModel")
    @ApiOperation(value = "根据id获取公用图块配置数据")
    public SummaryDto getCommonModel(ModelConfigEntity modelConfig) throws Exception {
      return commonModelConfigService.getSummaryModelByParams(modelConfig);
    }

    @GetMapping("/summaryTest")
    @ApiOperation(value = "简单的数据查询例子")
    public List<WssjzyDto> summaryTest(Params params) throws Exception {
        return wssjzyService.dataSummary(params);
    }

}
